from django import template

register = template.Library()

@register.simple_tag(takes_context=True)
def getParams(context):
  getParams = context['request'].GET.copy();
  url = '?';

  # Add existing GET params to url
  for item in getParams:
    if (url != '?'):
      url += '&'
    url += item + "=" + getParams.get(item)

  return url
